gtk-demo: Tweak descriptions of constraints demos
authorMatthias Clasen <mclasen@redhat.com>
Fri, 30 Oct 2020 19:26:37 +0000 (15:26 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 30 Oct 2020 19:26:37 +0000 (15:26 -0400)
Make these a little longer, and include more details.

demos/gtk-demo/constraints.c
demos/gtk-demo/constraints2.c
demos/gtk-demo/constraints3.c
demos/gtk-demo/constraints4.c

index 29facd12fd6d93fc72b751adedde229e03208b95..2104948ad5c13c970daa424cb1b8728bc23ac045 100644 (file)
@@ -2,8 +2,15 @@
  * #Keywords: GtkLayoutManager
  *
  * GtkConstraintLayout provides a layout manager that uses relations
- * between widgets (also known as "constraints") to compute the position
+ * between widgets (also known as “constraints”) to compute the position
  * and size of each child.
+ *
+ * In addition to child widgets, the constraints can involve spacer
+ * objects (also known as “guides”). This example has a guide between
+ * the two buttons in the top row.
+ *
+ * Try resizing the window to see how the constraints react to update
+ * the layout.
  */
 
 #include <glib/gi18n.h>
index d63b3697394a952313d3ed7b333c9e8957563825..124a5e18ef22b479ad344cb3f029e865d7808f81 100644 (file)
@@ -1,7 +1,7 @@
 /* Constraints/Interactive
  * #Keywords: GtkConstraintLayout
  *
- * Demonstrate how constraints can be updates during user interaction.
+ * This example shows how constraints can be updated during user interaction.
  * The vertical edge between the buttons can be dragged with the mouse.
  */
 
index 0cb9b9770217075b5bec7f5931ff050e3996aa93..d702f75430632167004461d156d9a1d65ffd8aa0 100644 (file)
@@ -2,6 +2,10 @@
  *
  * GtkConstraintLayout allows defining constraints using a
  * compact syntax called Visual Format Language, or VFL.
+ *
+ * A typical example of a VFL specification looks like this:
+ *
+ * H:|-[button1(==button2)]-12-[button2]-|
  */
 
 #include <glib/gi18n.h>
index 8bde6af653dce52858b9cad425258961cac0b614..4b4ca496437541925109b1e3499c67c7c1067b54 100644 (file)
@@ -1,8 +1,8 @@
 /* Constraints/Builder
  *
- * GtkConstraintLayouts can be created in .ui files, and
- * constraints can be set up at that time as well, as this
- * example demonstrates.
+ * GtkConstraintLayouts can be created in .ui files, and constraints can be
+ * set up at that time as well, as this example demonstrates. It uses the
+ * same setup as the “Simple” constraints demo.
  */
 
 #include <glib/gi18n.h>
@@ -22,9 +22,24 @@ constraints_grid_init (ConstraintsGrid *grid)
 {
 }
 
+static void
+constraints_grid_dispose (GObject *object)
+{
+  GtkWidget *widget = GTK_WIDGET (object);
+  GtkWidget *child;
+
+  while ((child = gtk_widget_get_first_child (widget)))
+    gtk_widget_unparent (child);
+
+  G_OBJECT_CLASS (constraints_grid_parent_class)->dispose (object);
+}
+
 static void
 constraints_grid_class_init (ConstraintsGridClass *klass)
 {
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->dispose = constraints_grid_dispose;
 }
 
 GtkWidget *